<?php
require_once dirname(__FILE__)."/base_model.php";
class workrecords extends base_model
{

	const WORKRECORD_TABLE = "table_workrecord";

	public function __construct() {
		parent::__construct();
	}

	/**
	 * 添加工作说明
	 * $row = array(
			'staff_name'		=> $staff_name,
			'operate_date'		=> $operate_date,
			'operate_content'	=> $operate_content,
			'event_id'			=> $event
		);
	 **/
	public function createRecord(array $row)
	{
		return $this->db->insert(self::WORKRECORD_TABLE, $row);;
	}

	/**
	 * 根据事件ID查询工作纪录
	 **/
	public function getRecordsById($eventId)
	{
		 $this->db->select("staff_name, operate_date, operate_content");
		 $this->db->where("event_id", $eventId);
		 $this->db->from(self::WORKRECORD_TABLE);
		 return $this->db->get()->result_array();
	}
}